﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Text;
using System.Xml;
using System.IO;

/// <summary>
///hskbase 的摘要说明
/// </summary>
public class hskbase : BasePage
{
    public hskbase()
    {
       
    }
    static string restr = "";
    static DateTime stime;
    protected string GetHasApp()
    {
        if (restr == null || restr == "" || DateTime.Now.Hour - stime.Hour > 1 || DateTime.Now.Hour - stime.Hour < 0)
        {
            string content = string.Empty;
            try
            {
                string postString = "";
                byte[] postData = Encoding.ASCII.GetBytes(postString);
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.haoshiku.com/index.php?app=home&mod=Api&act=hotapp&source=1");
                request.Method = "POST";
                request.KeepAlive = false;
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = postData.Length;
                request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)";
                request.Headers.Add("Cache-Control", "no-cache");
                request.Headers.Add("Pragma", "no-cache");
                System.IO.Stream outputStream = request.GetRequestStream();
                outputStream.Write(postData, 0, postData.Length);
                outputStream.Close();

                WebResponse response = request.GetResponse();
                System.IO.Stream responseStream = response.GetResponseStream();
                StreamReader sr = new System.IO.StreamReader(responseStream);
                content = sr.ReadToEnd();

                responseStream.Close();
                sr.Close();
                response.Close();

                restr = content;
            }
            catch (Exception ex)
            {
                //InSertWrong(string.Format("发送短信出错{0}--<{1}>: Error --- {2}", url, DateTime.Now.ToString(), ex.Message));
                return "{\"result\":0}";
            }
        }
        return restr;
    }
}
